
export interface OfflineServiceProviderDetail {
  id?: number,
  userId?: number;
  contactInfo?: string;
  name?: string;
  phoneNumber?: string;
  demandDescription?: string;
  provinceInfo?: any;
  type?: string;
  provinceId?: string;
  cityId?: string;
  districtId?: string;
  partnerType?: string;
  singleFlag?: boolean;
  status?: number;
}

export const labelMap = {
  userId: { name: 'userId', label: '系统用户' },
  provinceInfo: { name: 'provinceInfo', label: '所属地区' },
  name: { name: 'name', label: '用户或昵称' },
  partnerType: { name: 'partnerType', label: '合伙人类型' },
  type: { name: 'type', label: '数据类型' },
  phoneNumber: { name: 'phoneNumber', label: '手机号' },
  demandDescription: { name: 'demandDescription', label: '需求描述' },
  singleFlag: { name: 'singleFlag', label: '单身标识' },
  partnerTypeAmount: { name: 'partnerTypeAmount', label: '合伙金额' },
};

export const typeList: any[] = [
  { value: 'emotion', label: '情感商学院' },
  { value: 'partner', label: '合伙人' },
];

export const flagList: any[] = [
  { value: true, label: '是' },
  { value: false, label: '否' },
];

export const rulesRef = {
  userId: [
    {
      required: true,
      message: '系统用户不能为空！',
    },
  ],
  contactInfo: [
    {
      required: true,
      message: '联系方式不能为空！',
    },
  ],
  name: [
    {
      required: true,
      message: '姓名或昵称不能为空！',
    },
  ],
  phoneNumber: [
    {
      required: true,
      message: '手机号不能为空',
    },
    {
      pattern: /^1[3-9]\d{9}$/,
      message: '手机号格式不正确',
      trigger: 'blur', // 在失去焦点时校验
    },
  ],
  demandDescription: [
    {
      required: true,
      message: '需求描述不能为空！',
    },
  ],
  partnerType: [
    {
      required: true,
      message: '合伙人类型不能为空！',
    },
  ],
  singleFlag: [
    {
      required: true,
      message: '单身标识不能为空！',
    },
  ],
  type: [
    {
      required: true,
      message: '类型不能为空',
    },
  ],
  provinceInfo: [
    {
      required: true,
      message: '所属区域不能为空！',
      validator: (_rule, value: any[]) => {
        if (!Array.isArray(value) || value.length === 0) {
          return Promise.reject('所属区域必须为一个非空数组！');
        }
        return Promise.resolve();
      },
    },
  ],
};